import type { RouteRecordNormalized } from "vue-router";
import request from "@/utils/request";

export type RoleType = "" | "*" | "admin" | "user";

export interface UserState {
  name?: string;
  avatar?: string;
  job?: string;
  organization?: string;
  location?: string;
  email?: string;
  introduction?: string;
  personalWebsite?: string;
  jobName?: string;
  organizationName?: string;
  locationName?: string;
  phone?: string;
  registrationDate?: string;
  accountId?: string;
  certification?: number;
  role: RoleType;
}

const BASE_URL = "/user";

export const getUserInfo = () => request.get<UserState>(BASE_URL + "info");

export const getMenuList = () =>
  request.get<RouteRecordNormalized[]>(BASE_URL + "/menu");
